<template>
	<view class="header-bg-image header-bg">
		<view style="height: 50rpx;"></view>
		<view class="padding-30">
			<view class="margin-30-0 flex-around" @click="$tools.navigateBack()">
				<u-icon name="arrow-left" color="#333333" size="20"></u-icon>
				<view class="fontSize-18 color-000 flex1 text-center">门店</view>
				<view style="width: 40rpx;"></view>
			</view>
			<!-- <u-search placeholder="搜索门店" bgColor="#ffffff" v-model="keyword" @custom=""></u-search> -->
			<view class="margin-30-0">
				<u-tabs :list="list1" @click="click" lineColor="#967C5E"></u-tabs>
			</view>
			<!-- 门店列表 -->
			<view class="bg-fff border-radius20 padding-30 flex-between margin-bottom30"
			v-for="(item,index) in list" :key="index">
				<view class="">
					<view class="flex-alignItems-center margin-bottom20">
						<u-icon name="map" color="#967C5E" size="20"></u-icon>
						<view class="fontSize-15 color-000 margin-left20">{{item.title}}</view>
					</view>
					<view class="fontSize-15 color-999 text-ellipsis" style="width: 560rpx;">
						{{item.address}}
					</view>
				</view>
				<view class="phone-view flex-center" @click="callPhone(item.mobile)">
					<u-icon name="phone-fill" color="#333333" size="20"></u-icon>
				</view>
			</view>
			<u-empty v-if="list.length == 0"
			        mode="list"
			        icon="http://cdn.uviewui.com/uview/empty/list.png"
					width="150px"
					height="150px"
					text="列表为空"
					textSize="18"
			>
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				keyword:''
			}
		},
		onShow() {
			this.getStoreList()
		},
		methods:{
			// // 搜索门店
			// searchStoreList(){
			// 	let res = await this.$http.post(this.$api.goods_list,{},{token:true})
			// 	console.log(res)
			// },
			 // 拨打电话
			callPhone(value){
				 uni.makePhoneCall({
				    phoneNumber: value
				 });
			},
			async getStoreList(){
				let res = await this.$http.post(this.$api.store_list,{type:1},{token:true})
				if(res.code ==1){
					this.list = res.data
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.phone-view{
		width: 60rpx;
		height: 60rpx;
		border-radius: 60rpx;
		background-color: #F0F0F0;
		flex-shrink: 0;
	}
	.header-bg-image {
		width: 100%;
		min-height: 100vh;
	}
</style>